const Collection = require('../../config/db.config').Collection
const ObjectId = require('mongodb').ObjectId

module.exports = app => {
    const mongoose = app.mongoose
    const date = new Date()
    const MenuSchema = mongoose.Schema({
        userId : {
            type: String
        },
        dirName : {
            type: String,
            require: true
        },
        dirId : {
            type: String,
            default: new ObjectId()
        },
        parentId : {
            type: String
        },
        type: {
            type: String
        },
        children: [Object],
        createTime: {
            type: Number,
            default: date.getTime()
        },
        createLocalTime: {
            type: String,
            default: date.toLocaleString()
        }
    })
    return mongoose.model('Menu', MenuSchema, Collection.MENU_DATA)
}
